﻿<?php
session_start();

if (!isset($_SESSION['login']) && !$_SESSION['login'] == true) {
	header ("Location: index.php");
}
include("LangHeader.php");
include 'config.php';

mysqli_set_charset($con, 'utf8');

?>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<link rel="stylesheet" type="text/css" href="style.css" />
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
<script src="scripts/jquery.tablesorter.js"></script>
<title>Sales Makeover</title>
</head>

<body>
	<div class="bodyLeft" id="bodyLeft">
		<?php include("menu.html"); ?>
	</div>
	<div class="bodyRight" id="bodyRight">
		<div class="container_head">
			<?php include("header.html"); ?>
		</div>
		<div class="container" id="container">
			<div class="content">

			<center>
				<img border="0" src="content\icons\Buttons\step_1_active.png" width="50">
				<img border="0" src="content\icons\Buttons\step_2_inactive.png" width="50">
				<br>
				<br>
				</center>

				<div style='color:#f8f8f8; text-align:left;width:84%;margin-left:8%;margin-right:auto;' class="tr" key="create_Info"></div><br/>
				
				<form name="create_Innovation_step_1" id="create_Innovation_step_1" class="create_Innovation_step_1"  method="post" action="createInnovation2.php" accept-charset="UTF-8" onsubmit="return validateForm()">
					
					<div class="createInnovationLabel tr" key="create_Name"></div>
					<input type="text" name="Customer" >
					<div class="createInnovationLabel tr" key="create_Project"></div>
					<input type="text" name="Project" >
					<br/>
					<!--<input type="text" name="Date" onfocus="if(this.value == '*Datum') { this.value = ''; }" onblur="if(this.value == '') { this.value = '*Datum'; }" value="*Datum">
					<br/>-->
					<div class="createInnovationLabel tr" key="create_Value"></div>
					<input type="text" name="BusinessValue" >
					<br/>
					<div class="createInnovationLabel tr" key="create_Contact"></div>
					<input type="text" name="Contact" >
					<div class="createInnovationLabel tr" key="create_Role"></div>
					<select name="OwnerRole" style='width:85%;'>
						
						<option selected disabled>-----</option>
						<?php 
						
						$stmt = $con->prepare('SELECT * FROM Innovation_Role');
						$stmt->execute();
						$result = $stmt->get_result();
						
						while($row = $result->fetch_assoc())
						{
							echo "<option value=\"" . $row['ID'] . "\" class=\"tr\" key=\"". $row['Value'] ."\"></option>";
						}
						
						?>
						
					</select>
					
					<input type="submit"  class="tr" key="create_Next">
					<div style="margin-top:30px;">
					
					</div>
				</form>
				
			</div>
		</div>
	</div>
</body>

</html>
<script type="text/javascript" charset="UTF-8">
	function validateForm()
	{
		var customerVal = document.forms["create_Innovation_step_1"]["Customer"].value;
		if(customerVal == "")
		{
			alert(getText("error_Name"));
			return false;
		}	
		var projectVal = document.forms["create_Innovation_step_1"]["Project"].value;
		if(projectVal == "")
		{
			alert(getText("error_Projekt"));
			return false;
		}
		var valueVal = document.forms["create_Innovation_step_1"]["BusinessValue"].value;
		if(valueVal == "")
		{
			alert(getText("error_BusinessValue"));
			return false;
		}
		var contactVal = document.forms["create_Innovation_step_1"]["Contact"].value;
		if(contactVal == "")
		{
			alert(getText("error_Contact"));
			return false;
		}
		var ownerRoleVal = document.forms["create_Innovation_step_1"]["OwnerRole"].value;
		if(ownerRoleVal == "-----")
		{
			alert(getText("error_OwnerRole"));
			return false;
		}
	};
</script>